{
if (xp_theme_is_active () && detail && !strcmp (detail, "menuitem"))
{
+ gint cx, cy;
+ gint new_y, new_height;
+ gint y_offset;
+
+ xp_theme_get_element_dimensions (XP_THEME_ELEMENT_MENU_SEPARATOR,
+ state_type,
+ &cx, &cy);
+
+ /* Center the separator */
+ y_offset = (area->height / 2) - (cy / 2);
+ new_y = y_offset >= 0 ? area->y + y_offset : area->y;
+ new_height = cy;
+
if (xp_theme_draw
- (window, XP_THEME_ELEMENT_MENU_SEPARATOR, style, x1, y, x2, 1,
+ (window, XP_THEME_ELEMENT_MENU_SEPARATOR, style, x1, new_y, x2, new_height,
state_type, area))
{
return;
#define MBI_DISABLEDHOT 5
#define MBI_DISABLEDPUSHED 6
+#define MENU_POPUPGUTTER 13
#define MENU_POPUPITEM 14
#define MENU_POPUPSEPARATOR 15
typedef HRESULT (FAR PASCAL *DrawThemeParentBackgroundFunc) (HWND hwnd,
HDC hdc,
RECT *prc);
+typedef HRESULT (FAR PASCAL *GetThemePartSizeFunc) (HTHEME hTheme,
+ HDC hdc,
+ int iPartId,
+ int iStateId,
+ RECT *prc,
+ int eSize,
+ SIZE *psz);
static GetThemeSysFontFunc get_theme_sys_font_func = NULL;
static GetThemeSysColorFunc get_theme_sys_color_func = NULL;
static IsAppThemedFunc is_app_themed_func = NULL;
static IsThemeBackgroundPartiallyTransparentFunc is_theme_partially_transparent_func = NULL;
static DrawThemeParentBackgroundFunc draw_theme_parent_background_func = NULL;
+static GetThemePartSizeFunc get_theme_part_size_func = NULL;
static void
xp_theme_close_open_handles (void)
get_theme_sys_metric_func = (GetThemeSysSizeFunc) GetProcAddress (uxtheme_dll, "GetThemeSysSize");
is_theme_partially_transparent_func = (IsThemeBackgroundPartiallyTransparentFunc) GetProcAddress (uxtheme_dll, "IsThemeBackgroundPartiallyTransparent");
draw_theme_parent_background_func = (DrawThemeParentBackgroundFunc) GetProcAddress (uxtheme_dll, "DrawThemeParentBackground");
+ get_theme_part_size_func = (GetThemePartSizeFunc) GetProcAddress (uxtheme_dll, "GetThemePartSize");
}
if (is_app_themed_func && is_theme_active_func)
get_theme_sys_metric_func = NULL;
is_theme_partially_transparent_func = NULL;
draw_theme_parent_background_func = NULL;
+ get_theme_part_size_func = NULL;
}
static HTHEME
ret = 1;
break;
- case XP_THEME_ELEMENT_MENU_ITEM:
case XP_THEME_ELEMENT_MENU_SEPARATOR:
+ ret = TS_NORMAL;
+ break;
+
+ case XP_THEME_ELEMENT_MENU_ITEM:
switch (state)
{
case GTK_STATE_SELECTED:
part_state = xp_theme_map_gtk_state (element, state_type);
+ /* Support transparency */
+ if (is_theme_partially_transparent_func (theme, element_part_map[element], part_state))
+ draw_theme_parent_background_func (GDK_WINDOW_HWND (win), dc, pClip);
+
draw_theme_background_func (theme, dc, element_part_map[element],
part_state, &rect, pClip);
return FALSE;
}
+gboolean
+xp_theme_get_element_dimensions (XpThemeElement element,
+ GtkStateType state_type,
+ gint *cx, gint *cy)
+{
+ HTHEME theme;
+ SIZE part_size;
+ int part_state;
+
+ if (!xp_theme_is_active ())
+ return FALSE;
+
+ theme = xp_theme_get_handle_by_element (element);
+ if (!theme)
+ return FALSE;
+
+ part_state = xp_theme_map_gtk_state (element, state_type);
+
+ get_theme_part_size_func (theme,
+ NULL,
+ element_part_map[element],
+ part_state,
+ NULL,
+ TS_MIN,
+ &part_size);
+
+ *cx = part_size.cx;
+ *cy = part_size.cy;
+
+ if (element == XP_THEME_ELEMENT_MENU_ITEM ||
+ element == XP_THEME_ELEMENT_MENU_SEPARATOR)
+ {
+ SIZE gutter_size;
+
+ get_theme_part_size_func (theme,
+ NULL,
+ MENU_POPUPGUTTER,
+ 0,
+ NULL,
+ TS_MIN,
+ &gutter_size);
+
+ *cx += gutter_size.cx * 2;
+ *cy += gutter_size.cy * 2;
+ }
+
+ return TRUE;
+}
+
gboolean
xp_theme_get_system_font (XpThemeClass klazz, XpThemeFont fontId,
OUT LOGFONTW *lf)
int height, GtkStateType state_type,
GdkRectangle *area);
gboolean xp_theme_is_drawable (XpThemeElement element);
+gboolean xp_theme_get_element_dimensions (XpThemeElement element,
+ GtkStateType state_type,
+ gint *cx, gint *cy);
gboolean xp_theme_get_system_font (XpThemeClass klazz, XpThemeFont fontId, OUT LOGFONTW *lf);
gboolean xp_theme_get_system_color (XpThemeClass klazz, int colorId, OUT DWORD *pColor);
gboolean xp_theme_get_system_metric (XpThemeClass klazz, int metricId, OUT int *pVal);